UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L7msNyPoAqpFXtVOpwHK55f+SMA9SjQNjv6tXX2Xa6g=' 
WHERE 
  key_id = 'd4fef25469061b4d49fef85354b49565abc1a0c7ff682848b26877f18268bcd2' 
  AND (
    token = 'L7msNyPoAqpFXtVOpwHK55f+SMA9SjQNjv6tXX2Xa6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047