UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qnAf+wl7HApJz1HdJfv6HZf3YSY5gIS/A2SOjiIiPBQ='
WHERE
key_id = 'bfa112436a9941cd3d5dfea8b84b2b2cac2fa2e698806403b5ebe3b917237af0'
AND (
token = 'qnAf+wl7HApJz1HdJfv6HZf3YSY5gIS/A2SOjiIiPBQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)