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