UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5pa5sKicXSGv828FsimG249l6y6BTrywdZp7CCLm7jY='
WHERE
key_id = '654cbf2fc2e731468a15f2d73fba70a2767db37d6da7dd50580d4d4fa24f6710'
AND (
token = '5pa5sKicXSGv828FsimG249l6y6BTrywdZp7CCLm7jY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)