UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XpESmUF4UhtxvqchRzCeErmVGEmvSkMeHxUYkroaXaU='
WHERE
key_id = '742bad1f48e0b7064b53d8888c9a80bd2af0895e06cd128c315a3e3e54cc56f5'
AND (
token = 'XpESmUF4UhtxvqchRzCeErmVGEmvSkMeHxUYkroaXaU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)