UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aWLDOnKMl3v6mUyPm+HVRzms4R9TPBaGLM570673/wc='
WHERE
key_id = 'b52fcc6d0ab76a1881bcc8c11419e4b4e199add1667c17f3c77c906f6c092990'
AND (
token = 'aWLDOnKMl3v6mUyPm+HVRzms4R9TPBaGLM570673/wc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)