UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i7126CngScnFkugddVM52vQeqA3oUs55+p5+RuJFE0U='
WHERE
key_id = 'c60a7bbc8adabd5d30a412c5596acf4a25d1c94e177d799a7193f717db891afb'
AND (
token = 'i7126CngScnFkugddVM52vQeqA3oUs55+p5+RuJFE0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)