UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yTwP25r3PuRjD9kHMSWIPvF+KZyKHbPrhQFBtQX+0RE=' 
WHERE 
  key_id = '0278aa9a1f90571d16dd5a1abdf6532c2181cf3e5a57f52466b211d4cb6d7980' 
  AND (
    token = 'yTwP25r3PuRjD9kHMSWIPvF+KZyKHbPrhQFBtQX+0RE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055