UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LcBi5iQFxeYqMgmXtckk4Y9b19b+qcNr/UCb+HEXvqk='
WHERE
key_id = '49cc5c3924f71e3d3aa8dfd462657bf9937388aeb19f8dcf9b8f08ef3a7b6f45'
AND (
token = 'LcBi5iQFxeYqMgmXtckk4Y9b19b+qcNr/UCb+HEXvqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)