UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QPg9WcyHR7P05q1cqG7aXpEP3SneeqXFjU9PuzPFR0I=' 
WHERE 
  key_id = '4f0d540f432c0e4db7ffaff8ff2453fcfafc137834d24d81c1e2f4fa9735790c' 
  AND (
    token = 'QPg9WcyHR7P05q1cqG7aXpEP3SneeqXFjU9PuzPFR0I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034