UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fqsvSJL3klfaEaWKZmdEmixFfftlcxfS3EJ5Nnt7sd0=' 
WHERE 
  key_id = '83fe5507224749aa6939b31f418d5c7a586d577f5bfaadabb5885377f155fe96' 
  AND (
    token = 'fqsvSJL3klfaEaWKZmdEmixFfftlcxfS3EJ5Nnt7sd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031