UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3NRelQ+f86OOB/wOrdZNxkMdht2w0NHXJwxoYlSvmeI=' 
WHERE 
  key_id = 'edffd89c44fb82045c65e2c5272f3ecaf7faad6172ac82ca887419a27f232584' 
  AND (
    token = '3NRelQ+f86OOB/wOrdZNxkMdht2w0NHXJwxoYlSvmeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022