UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZfmkJRzKvv3qzwQRimtkqeRk/iSJYMoRSUoOfxCes+k=' 
WHERE 
  key_id = '9ca963efe6d3a7300c9569876ebb627f47455a3eeb043262f293a1abb01473d9' 
  AND (
    token = 'ZfmkJRzKvv3qzwQRimtkqeRk/iSJYMoRSUoOfxCes+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037