UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DZs5OihPvUftjBeZIF8d2+aZtwX/VmKoUV2qS6eMkig='
WHERE
key_id = 'ae5085096c83b35fbfa1ebd444f923c5370cec8ef441a0422c4b6037ff7eda17'
AND (
token = 'DZs5OihPvUftjBeZIF8d2+aZtwX/VmKoUV2qS6eMkig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)