UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cTMGy1oae3598Mq+F1MnblbJoel4tDCqpHUSJgAKwXE=' 
WHERE 
  key_id = 'cb0f247bb20f7eae8a647f7e15a1bf1ed5a9347564c5864a4e6d75c435c71e15' 
  AND (
    token = 'cTMGy1oae3598Mq+F1MnblbJoel4tDCqpHUSJgAKwXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036