UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P81jH23lIbD1RyJ19lpi8eRYfYq5F0Yxt3si3M/mm2M='
WHERE
key_id = 'f5bc7db3544a720dca2b516a5624fd6759ac4401072e45c099ecd1e2555c3ce7'
AND (
token = 'P81jH23lIbD1RyJ19lpi8eRYfYq5F0Yxt3si3M/mm2M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)