UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N0AYph9x7YFR3OyzoDMhH1dEMcWiNrEuUU0X0UbLR/c='
WHERE
key_id = 'a184e4a9f297487de64d3a1e7e6f9d0d3cb256a19e3016d73b401b5edd71e59d'
AND (
token = 'N0AYph9x7YFR3OyzoDMhH1dEMcWiNrEuUU0X0UbLR/c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)