UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sNedFDKsqprldljlIuOvTwNgd3cSrmJIesjWagN/M6s=' 
WHERE 
  key_id = '362da9bf14894e387286fb4a8595dd4d12d6e5b5b6f6c3ec06041ce7a3ecf36e' 
  AND (
    token = 'sNedFDKsqprldljlIuOvTwNgd3cSrmJIesjWagN/M6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053