UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sa+Xwd9hMmmo0KE6PLHf6ZZGH4miVqEuknNdgr3WFc8=' 
WHERE 
  key_id = '9d6be1bb848bac4b18d12c1347fd6338fc45d2cc1e8aa03a6f53d930bc1d41f4' 
  AND (
    token = 'sa+Xwd9hMmmo0KE6PLHf6ZZGH4miVqEuknNdgr3WFc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025