UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dNxmkpb7hKh+1LVMuFsQ7wE5KTL8O0rrmLVKLhymaK4='
WHERE
key_id = '8cbb071332c995b35ef37964bfb599e51610ad5a1747a1722db17a6c83ced50a'
AND (
token = 'dNxmkpb7hKh+1LVMuFsQ7wE5KTL8O0rrmLVKLhymaK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)