UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'foFCDdXCE4Ub/VMxepMCcigkMuWtw69g/ACyw8pwdy8='
WHERE
key_id = '5985d9d7af3044325f6c114488d67d9c8ce1dda006ac5845bd05f977c298874c'
AND (
token = 'foFCDdXCE4Ub/VMxepMCcigkMuWtw69g/ACyw8pwdy8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)