UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cNtLHFyWjEyx9/EDt7ci7y3nALS6Zcl2BYV4/web+yw='
WHERE
key_id = '48ffb7b1a1600dfc348fcea4dafdb38b1e3fcc3bb9ca80665dd7ed5952be7e6a'
AND (
token = 'cNtLHFyWjEyx9/EDt7ci7y3nALS6Zcl2BYV4/web+yw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)