UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YX58zxZG3zxyijCfE7Z195+wWrWb3DbpKIFqvXaGqWk='
WHERE
key_id = 'ba711935e90f302ef9e046c81a8a7442a8aeb8d20c1aeab86034d4a641c0cddb'
AND (
token = 'YX58zxZG3zxyijCfE7Z195+wWrWb3DbpKIFqvXaGqWk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)