UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QW7YPjujkFWb0ABds6ZfRP7nteOgN7sRjSe10QPLSZo='
WHERE
key_id = 'c2c0a201a23c4d991fe56b38dc4a8245f5b786d5d0c3be18a4248f4887a1ceaf'
AND (
token = 'QW7YPjujkFWb0ABds6ZfRP7nteOgN7sRjSe10QPLSZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)