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