UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MIthai/aesirT8mFg5fSmRIdDZltetuYOJFVlMOtrU4=' 
WHERE 
  key_id = '87bc1c70314d3cef43e1e04661a349ca943fc3a9f94fe9a19191c61630448afd' 
  AND (
    token = 'MIthai/aesirT8mFg5fSmRIdDZltetuYOJFVlMOtrU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030