UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qT/gbpj7JGrGHdueGpZ1QoxB+uLWxnUoTDEKZOKeFWA=' 
WHERE 
  key_id = 'e1d7a984c1e9c12e4dfceec60a6f94d02e2ff1f877eefb74145be18d4eb492ac' 
  AND (
    token = 'qT/gbpj7JGrGHdueGpZ1QoxB+uLWxnUoTDEKZOKeFWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026