UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CTkwpREQeedz8VjsLm8pf6Dl3t5r0dpFmLnQfqpsfW8=' 
WHERE 
  key_id = '402ce2dc253a10543e85be9cb8ec1b6edbb62c71bdb07560ad10a08596e2cf59' 
  AND (
    token = 'CTkwpREQeedz8VjsLm8pf6Dl3t5r0dpFmLnQfqpsfW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038