UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DAavHdwKoCh2iF14kTFNhbyq4rA8/udjsiEQB0yv7+s='
WHERE
key_id = '52e3f9535002e706d7a2219eb1e13309f0eaedfeb040a086737898b527145e3f'
AND (
token = 'DAavHdwKoCh2iF14kTFNhbyq4rA8/udjsiEQB0yv7+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)