UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VYszecWubPjEwCAk3jVVjGeZciWrU4DNgSKkzoHdZDA=' 
WHERE 
  key_id = '6a1388b14407e0e6b06aeedd662bca5805021d63270bd222a45dafa5496700b1' 
  AND (
    token = 'VYszecWubPjEwCAk3jVVjGeZciWrU4DNgSKkzoHdZDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063