UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bIs9IF3OxN55+UAPgIe2O0CuZ5uDRC3XFpZvImFAjEw='
WHERE
key_id = 'aae982ccffeefbd5f972b5e50e763d215905dfc333286d2b5cea22f3d96fcfe4'
AND (
token = 'bIs9IF3OxN55+UAPgIe2O0CuZ5uDRC3XFpZvImFAjEw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)