UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pG/SrfR75DYvXQt2uV7iEWH2ZWR7NKVr9S6KagSj/BA=' 
WHERE 
  key_id = '2087af6f94ef42bc9fca7897205ffb800a0ed78770c5223c507b959d081c79b3' 
  AND (
    token = 'pG/SrfR75DYvXQt2uV7iEWH2ZWR7NKVr9S6KagSj/BA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024