UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j4gcX1Vwy32i1jwfgE4tGWNWbPcw+24OiXQeqdlFepU=' 
WHERE 
  key_id = '2570ca28325d191aa30db13b0c45859d21569f04cc2470679565acb6dc6190dd' 
  AND (
    token = 'j4gcX1Vwy32i1jwfgE4tGWNWbPcw+24OiXQeqdlFepU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040