UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eQJSxCYusRthKUMkUitL52fHv//OP5aweQo53m6YVag=' 
WHERE 
  key_id = 'ded04c98145af68d638b21b542902cef0d9cb7993fe6779d4d549ed1419d6cad' 
  AND (
    token = 'eQJSxCYusRthKUMkUitL52fHv//OP5aweQo53m6YVag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025