UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tNqALZeWAZRWEkPLdvNpWV8DazAdPtDg3R8Wq0ev55k='
WHERE
key_id = 'd61a200995e413cfb240c15deb7cec040ab512d860076d63db3767d0a097cd35'
AND (
token = 'tNqALZeWAZRWEkPLdvNpWV8DazAdPtDg3R8Wq0ev55k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)