UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hJvhEA/aprvEHlnys0dOmhVdQXnMNK04IKHySdJiwtc='
WHERE
key_id = 'f82cf997948b02aeb0d1ef575725b41b0170b77627438acb4f48aa3c8595b4c5'
AND (
token = 'hJvhEA/aprvEHlnys0dOmhVdQXnMNK04IKHySdJiwtc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)