UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SgMyQAc21+6tW3WrG7Gbaam9xJNEU4VoL7XvKfN3eDo='
WHERE
key_id = '994095c02f0f90b87e23ad02940b2dcf439015d1fa15916946181df92eda9c71'
AND (
token = 'SgMyQAc21+6tW3WrG7Gbaam9xJNEU4VoL7XvKfN3eDo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)