UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LW0TPEcjbBIDpqU6BsXZ3l0GINhTaDfQD09qPQcSip0='
WHERE
key_id = 'b9892c92d40d9c9268bc79ce07ec08784a78f82d2d6443d9e3aaa7a43ae57242'
AND (
token = 'LW0TPEcjbBIDpqU6BsXZ3l0GINhTaDfQD09qPQcSip0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)