UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f3sa9qsLURw0Qa3IvQTjB9wlpkGvYZx4VjFE/ImcCGM='
WHERE
key_id = 'ca9b35e7fe2cbf33cac9f8f4164c01538a6b90cedacf5008fb8534b128cadad2'
AND (
token = 'f3sa9qsLURw0Qa3IvQTjB9wlpkGvYZx4VjFE/ImcCGM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)