UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JqQhI+sga/AdDZsv4/tLbJR1if9lrCZmBPSabIa5Z14='
WHERE
key_id = '97768927be5d790029d86afbf7bfd963d7c3dd5aee893790b8811e12e7b017c6'
AND (
token = 'JqQhI+sga/AdDZsv4/tLbJR1if9lrCZmBPSabIa5Z14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)