UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DOIwHg30BdGA+hg50J2g3YUo4h9/SatPstNgIeZVIes=' 
WHERE 
  key_id = '4fc51b0977da9e5fe1801974cb00d39bbdc7087c9ef2eb73a70ff7353f4421ca' 
  AND (
    token = 'DOIwHg30BdGA+hg50J2g3YUo4h9/SatPstNgIeZVIes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034