UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g4r9CEVg5Md994Wz4jRzO1jQIwwTkSoffv6oX55tWBo='
WHERE
key_id = '12ad19b5596e79f58f0b49a81991b90af9f58b3147bdad7282da23dce35d37e1'
AND (
token = 'g4r9CEVg5Md994Wz4jRzO1jQIwwTkSoffv6oX55tWBo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)