UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xfXnVqTU+X42Bm+26Cphqd58IILz5UwQ2zdAYBY4ao4=' 
WHERE 
  key_id = '3d46c7765ffbfb308f3b8912b2e69e8caf066806983fafe56210f522d48652ac' 
  AND (
    token = 'xfXnVqTU+X42Bm+26Cphqd58IILz5UwQ2zdAYBY4ao4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023