UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HIC0e77HqKyd2YD9FV9+DwTPlwDhvy7b5n2AR3ymlEM=' 
WHERE 
  key_id = '58e47723bb62fdc284fb73b0c41c3d394e04a9018dcecec34af49d3723f0605a' 
  AND (
    token = 'HIC0e77HqKyd2YD9FV9+DwTPlwDhvy7b5n2AR3ymlEM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049