UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N7/FgilcaDwb3eGZpb2SWgWmKE6iOewtkCSsgLbWLH8=' 
WHERE 
  key_id = '4d13d58db5b91b5bea8541a50143578078c5e4951f66f04c66550791a33da5af' 
  AND (
    token = 'N7/FgilcaDwb3eGZpb2SWgWmKE6iOewtkCSsgLbWLH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044