UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YOktJ1yNiaPuHmMQ2nLsdMeB28iAYSBY2K2U8rRxsl4='
WHERE
key_id = '0907ef43b9fd1513075370b3c5307b2e2866be601e25895d0a8d77a4fa4905b6'
AND (
token = 'YOktJ1yNiaPuHmMQ2nLsdMeB28iAYSBY2K2U8rRxsl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)