UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RHH7ZFlAZ9OVfyweA+/WxNqcr1bSjebfIzFvD9mwjjM=' 
WHERE 
  key_id = '1af8a131f8bff371129a2821489c292be26ebc1dff493e123767b08ec4771c2a' 
  AND (
    token = 'RHH7ZFlAZ9OVfyweA+/WxNqcr1bSjebfIzFvD9mwjjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050